﻿// owner 蒋家伟

#include "WordReaderUnitTest.h"

// qt
#include <QFile>

// jsdk
#include "UnitTestDataDefine.h"
#include "StringUtils.h"
#include "UnitTestUtils.h"
#include "Dbg_Warn_Define.h"
#include "IWordReader.h"

using namespace std;
using namespace jsdk;

UNIT_TEST_START(jsdk, WordReaderUnitTest)
{
    WordReaderUnitTest test;
    //bool success = test.testReadWordTable();
    //DBG_WARN_AND_RETURN_FALSE_UNLESS(success, L"测试读取word表格失败", L"jiangjiawei", L"2023-07-19");

    return true;
}

bool jsdk::WordReaderUnitTest::testReadWordTable() const
{
    std::wstring fileName = L"C:\\Users\\87476\\Desktop\\代偿报告.docx";
    bool success = QFile::exists(QString::fromStdWString(fileName)); 
    OwnerPtr<IWordReader> opWordReader = IWordReader::create();
    DBG_WARN_AND_RETURN_FALSE_UNLESS(opWordReader, L"word打开失败", L"蒋家伟", L"2023-11-24");
    success = opWordReader->openDocument(fileName);
    DBG_WARN_AND_RETURN_FALSE_UNLESS(success, fileName + L"打开失败", L"蒋家伟", L"2023-11-24");
    success = opWordReader->openTable(1);
    DBG_WARN_AND_RETURN_FALSE_UNLESS(success, L"表格1打开失败", L"蒋家伟", L"2023-11-24");

    return true;
}
